﻿@model BMS.ViewModels.OrderModelList

@{
    ViewBag.Title = "New Order";
    TempData.Keep();
}

@section featured {
    <section class="featured">
        <div class="content-wrapper" align="center">
            <hgroup class="title">
                <h1>@ViewBag.Message</h1>
            </hgroup>
        </div>
    </section>
}

<section>
    @using (Html.BeginForm("OrderCreation", "Order"))
    {
        @Html.ValidationSummary(true)

        <table align="center" border="0">
            <tr>
                <td align="right">@Html.LabelFor(m => m.order.FMName)</td>
                <td align="left">@Html.DropDownList("FMNameSV", Model.fmList, "", new { style = "width:150px", @maxlength = "150" })</td>
                <td align="right">@Html.LabelFor(m => m.order.ServiceOrderNo)</td>
                <td align="left">@Html.TextBoxFor(m => m.order.ServiceOrderNo, new { style = "width:150px", @maxlength = "150" })</td>
            </tr>
            <tr>
                <td align="right">@Html.LabelFor(m => m.order.Location)</td>
                <td align="left">@Html.TextBoxFor(m => m.order.Location, new { style = "width:150px", @maxlength = "150" })</td>
                <td align="right">@Html.LabelFor(m => m.order.Description)</td>
                <td align="left">@Html.TextBoxFor(m => m.order.Description, new { style = "width:500px", @maxlength = "500" })</td>
            </tr>
            <tr>
                <td align="right">@Html.LabelFor(m => m.order.WorkOrderNo)</td>
                <td align="left">@Html.TextBoxFor(m => m.order.WorkOrderNo, new { style = "width:150px", @maxlength = "150" })</td>
                <td align="right">@Html.LabelFor(m => m.order.Emergency)</td>
                <td align="left">@Html.DropDownList("ETNameSV", Model.emergencyList, "", new { style = "width:150px", @maxlength = "150" })</td>
            </tr>
            <tr>
                <td align="right">@Html.LabelFor(m => m.order.City)</td>
                <td align="left">@Html.DropDownList("CitySV", Model.cityList, "", new { style = "width:150px", @maxlength = "150" })</td>
            </tr>
            <tr>
                <td></td>
                <td><button type="submit" name="Command" value="Add">Add</button></td>
            </tr>
        </table>
    }
</section>

<section>
    @using (Html.BeginForm())
    {
        @Html.ValidationSummary(true)

        if (Model.orderList != null)
        {
            <br align="center" />
            <table align="center" border="1">
                <thead>
                    <tr>
                        <th width="50">@Html.LabelFor(m => m.order.FMName)</th>
                        <th width="100">@Html.LabelFor(m => m.order.ServiceOrderNo)</th>
                        <th width="200">@Html.LabelFor(m => m.order.Location)</th>
                        <th width="200">@Html.LabelFor(m => m.order.City)</th>
                        <th width="200">@Html.LabelFor(m => m.order.Description)</th>
                        <th width="100">@Html.LabelFor(m => m.order.WorkOrderNo)</th>
                        <th width="50">@Html.LabelFor(m => m.order.Emergency)</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model.orderList)
                    {
                        <tr>
                            <td align="center">@item.FMName</td>
                            <td align="center">@item.ServiceOrderNo</td>
                            <td align="center">@item.Location</td>
                            <td align="center">@item.City</td>
                            <td align="center">@item.Description</td>
                            <td align="center">@item.WorkOrderNo</td>
                            <td align="center">@item.Emergency</td>
                        </tr>
                    }
                    <tr>
                        <td align="right" colspan="6">Total Number</td>
                        <td align="center">@Html.DisplayFor(model => model.orderList.Count)</td>
                    </tr>
                </tbody>
            </table>
            <br align="center" />
            <input type="button" value="Confirm" style="width:100px" onclick="location.href='@Url.Action("OrderConfirmation", "Order")'" />
            <input type="button" value="Clear" style="width:100px" onclick="location.href='@Url.Action("OrderCreation", "Order")'" />    
        }
        
    }
</section>

<section>
    @using (Html.BeginForm("BackToMainMeun", "Home"))
    {
        <br align="center" />
        <input type="submit" value="Back To Main Menu" />
    }
</section>
